<template>
<div>

</div>
</template>
<script>
import moment from 'moment'
export default {
  data () {
    return {
      events: []
    }
  },
  created () {
    if(window.location.hostname === 'app.maibozhineng.com') {
      this.hubspot()
      this.ga()
    }
    //this.chameleon()
    //this.ga()
    // this.startSession()    //because of MB-20733
  },
  methods: {
    chameleon () {
      // eslint-disable-next-line
      /* chameleon.io script */
      !function(d,w){var t="SzV8HIMlVcZbrtWcYgYD3pzuCaf8CHm6mCmefF3sMgHsVL-1Q6Edu-ErVSlJu6iwn6rGzq",c="chmln",i=d.createElement("script");if(w[c]||(w[c]={}),!w[c].root){w[c].accountToken=t,w[c].location=w.location.href.toString(),w[c].now=new Date,w[c].fastUrl='https://fast.chameleon.io/';var m="identify alias track clear set show on off custom help _data".split(" ");for(var s=0;s<m.length;s++){!function(){var t=w[c][m[s]+"_a"]=[];w[c][m[s]]=function(){t.push(arguments);};}();}i.src=w[c].fastUrl+"messo/"+t+"/messo.min.js",i.async=!0,d.head.appendChild(i);}}(document,window);
      // eslint-disable-next-line no-undef
      chmln.identify(this.$store.state.user.id, {
        email: this.$store.state.user.realName
      })
    },
    hubspot () {
      var _hsq = window._hsq = window._hsq || []
      var _paq = window._paq = window._paq || []
      _hsq.push(['setPath', '/'])
      _paq.push(['trackPageView'])
    },
    ga () {
      if (this.$store.state.user.username) {
        this.$ga.event({
          eventAction: window.location.pathname.substr('/'),
          eventCategory: 'Client Tracking',
          eventLabel:
          this.$store.state.user.tenantCode +
          '/' +
          window.location.pathname.substr('/') +
          '/' +
          this.$store.state.user.id +
          '/' +
          this.$store.state.user.username +
          '/' +
          moment.utc().format(),
          eventValue: 0
        })
      }
    },
    startSession () {
      var _self = this
      window.__insp = window.__insp || []
      window.__insp.push(['wid', 1601380438])
      window.__insp.push(['tagSession', { name: _self.$store.state.user.name, tenantCode: _self.$store.state.user.tenantCode }])
      var ldinsp = function () {
        if (typeof window.__inspld !== 'undefined') return
        window.__inspld = 1
        var insp = document.createElement('script')
        insp.type = 'text/javascript'
        insp.async = true
        insp.id = 'inspsync'
        insp.src = (document.location.protocol === 'https:' ? 'https' : 'http') + '://cdn.inspectlet.com/inspectlet.js?wid=1601380438&r=' + Math.floor(new Date().getTime() / 3600000)
        var x = document.getElementsByTagName('script')[0]
        x.parentNode.insertBefore(insp, x)
      }
      setTimeout(ldinsp, 0)
    }
  }
}
</script>
<style>
</style>
